<template>
  <div class="func-comp-form">

    <ComponentGlobalSettingForm :id="id" :compConfigData="compConfigData"></ComponentGlobalSettingForm>

    <Tabs name="main_tabs" size="small" v-model="mainTabsValue">
      <TabPane name="main_tab" tab="main_tabs" label="主配置">

        <Tabs name="main_tabs_child" size="small">
          <TabPane tab="main_tabs_child" label="飞线配置">
            <Alert show-icon style="text-align: justify; padding-right: 10px;">
              散点配置中，所有的配置在设计器中均不是实时生效，调整之后，请保存页面并刷新设计器或打开预览界面查看调整后的效果
            </Alert>
            <Form :label-width="120">
              <FormItem label="飞线光点颜色">
                <PnColorPicker size="small" v-model="flyLinesOption.lineTripColor" alpha recommend/>
              </FormItem>
              <FormItem label="动画执行步长">
                <Tooltip content="执行每次动画的步长，数值越大动画效果越快" :max-width="200" placement="left">
                  <InputNumber size="small" :max="10" :min="0.1" :step="0.1" v-model="flyLinesOption.lineTripStep"></InputNumber>
                </Tooltip>
              </FormItem>
              <FormItem label="飞线底色">
                <Tooltip content="飞线的底色，建议设置一定的透明度，否则会出现飞线动画看不清的问题" :max-width="200" placement="left">
                  <PnColorPicker size="small" v-model="flyLinesOption.simpleLineColor" alpha recommend/>
                </Tooltip>
              </FormItem>
            </Form>

          </TabPane>
          <TabPane tab="main_tabs_child" label="地图配置">
            <BMapOptionConfigForm v-model="mapOption"></BMapOptionConfigForm>
          </TabPane>
        </Tabs>

      </TabPane>
      <TabPane name="datasource_tab" tab="main_tabs" label="数据源">
        <DatasourceState v-if="mainTabsValue == 'datasource_tab'" targetComp="BMapFlyLinesComp"></DatasourceState>
      </TabPane>
      <TabPane name="interaction_tab" tab="main_tabs" label="交互">
        <Container v-if="mainTabsValue == 'interaction_tab'">
          <CustomJsDocument></CustomJsDocument>
          <BMapCustomJsDocument></BMapCustomJsDocument>
          <FormItemPanel title="初始化运行脚本">
            <CodeEditor v-model="customGlobalJsCode"></CodeEditor>
          </FormItemPanel>
        </Container>
      </TabPane>
    </Tabs>

  </div>
</template>

<script>

  import FuncCompFormMixin from '@/mixin/FuncCompFormMixin'

  import { createHelpers } from 'vuex-map-fields';

  const { mapFields } = createHelpers({
    getterType: 'designer/getLayoutItem',
    mutationType: 'designer/updateLayoutItem',
  });

  export default {
    name: 'BMapFlyLinesCompForm', // 此名称必须填写，且必须与组件文件名相同，并且必须加上Form字符
    mixins: [FuncCompFormMixin],
    data() {
      return {}
    },
    mounted() {

    },
    methods: {},
    computed: {
      ...mapFields({

        mapOption: 'component.compConfigData.mapOption',
        flyLinesOption: 'component.compConfigData.flyLinesOption'

      })
    }
  }
</script>

<style scoped>

</style>
